load("@rules_java//java:defs.bzl", "java_library")

test_deps_files = \
    heron_java_proto_files() + [
        "//heron/api/src/java:api-java-low-level",
        "//heron/api/src/java:classification",
        "//heron/common/src/java:basics-java",
        "//heron/common/src/java:config-java",
        "//heron/common/src/java:network-java",
        "//heron/common/src/java:utils-java",
        "//heron/healthmgr/src/java:healthmgr-java",
        "//heron/packing/src/java:roundrobin-packing",
        "//heron/scheduler-core/src/java:scheduler-java",
        "//heron/spi/src/java:common-spi-java",
        "//heron/spi/src/java:metricsmgr-spi-java",
        "//heron/spi/src/java:packing-spi-java",
        "//heron/spi/src/java:statemgr-spi-java",
        "//heron/spi/src/java:utils-spi-java",
        "//third_party/java:jackson",
        "//third_party/java:junit4",
        "//third_party/java:mockito",
        "//third_party/java:powermock",
        "@maven//:aopalliance_aopalliance",
        "@maven//:com_fasterxml_jackson_jaxrs_jackson_jaxrs_base",
        "@maven//:com_fasterxml_jackson_jaxrs_jackson_jaxrs_json_provider",
        "@maven//:com_fasterxml_jackson_module_jackson_module_jaxb_annotations",
        "@maven//:com_google_guava_guava",
        "@maven//:com_google_inject_extensions_guice_assistedinject",
        "@maven//:com_google_inject_guice",
        "@maven//:com_jayway_jsonpath_json_path",
        "@maven//:com_microsoft_dhalion_dhalion",
        "@maven//:commons_cli_commons_cli",
        "@maven//:it_unimi_dsi_fastutil",
        "@maven//:javax_annotation_javax_annotation_api",
        "@maven//:org_glassfish_hk2_external_javax_inject",
        "@maven//:javax_ws_rs_javax_ws_rs_api",
        "@maven//:net_minidev_json_smart",
        "@maven//:org_apache_commons_commons_math3",
        "@maven//:org_glassfish_hk2_hk2_api",
        "@maven//:org_glassfish_hk2_hk2_locator",
        "@maven//:org_glassfish_hk2_hk2_utils",
        "@maven//:org_glassfish_jersey_bundles_repackaged_jersey_guava",
        "@maven//:org_glassfish_jersey_core_jersey_client",
        "@maven//:org_glassfish_jersey_core_jersey_common",
        "@maven//:org_glassfish_jersey_ext_jersey_entity_filtering",
        "@maven//:org_glassfish_jersey_media_jersey_media_json_jackson",
        "@maven//:org_roaringbitmap_RoaringBitmap",
        "@maven//:org_yaml_snakeyaml",
        "@maven//:tech_tablesaw_tablesaw_core",
    ]

java_library(
    name = "healthmgr-tests",
    srcs = glob(["**/*.java"]) + ["//heron/healthmgr/src/java:healthmgr-main"],
    deps = test_deps_files,
)

java_tests(
    size = "small",
    data = ["//heron/config/src/yaml:test-config-internals-yaml"],
    test_classes = [
        "org.apache.heron.healthmgr.HealthManagerTest",
        "org.apache.heron.healthmgr.HealthPolicyConfigReaderTest",
        "org.apache.heron.healthmgr.common.PackingPlanProviderTest",
        "org.apache.heron.healthmgr.detectors.BackPressureDetectorTest",
        "org.apache.heron.healthmgr.detectors.GrowingWaitQueueDetectorTest",
        "org.apache.heron.healthmgr.detectors.LargeWaitQueueDetectorTest",
        "org.apache.heron.healthmgr.detectors.ProcessingRateSkewDetectorTest",
        "org.apache.heron.healthmgr.detectors.WaitQueueSkewDetectorTest",
        "org.apache.heron.healthmgr.diagnosers.DataSkewDiagnoserTest",
        "org.apache.heron.healthmgr.diagnosers.SlowInstanceDiagnoserTest",
        "org.apache.heron.healthmgr.diagnosers.UnderProvisioningDiagnoserTest",
        "org.apache.heron.healthmgr.resolvers.ScaleUpResolverTest",
        "org.apache.heron.healthmgr.sensors.BackPressureSensorTest",
        "org.apache.heron.healthmgr.sensors.BufferSizeSensorTest",
        "org.apache.heron.healthmgr.sensors.ExecuteCountSensorTest",
        "org.apache.heron.healthmgr.sensors.MetricsCacheMetricsProviderTest",
        #        "org.apache.heron.healthmgr.sensors.TrackerMetricsProviderTest",
    ],
    runtime_deps = [
        ":healthmgr-tests",
    ],
)
